import { Injectable, NestMiddleware } from '@nestjs/common';

@Injectable()
export class InterceptorMiddleware implements NestMiddleware {
  use(req: any, res: any, next: () => void) {
    if (Math.random() > 0.4) {
      res.send('检测到您的请求非法，已被拦截');
      return;
    }
    next();
  }
}
